package allinpay.yun.demo.order;

import allinpay.yun.demo.DemoUtils;
import allinpay.yun.demo.IDemoHandler;
import org.json.JSONArray;
import org.json.JSONObject;

public class ConsumeApplyHandler implements IDemoHandler {
    @Override
    public JSONObject getRequestParams() throws Exception {
        DemoUtils rsa = new DemoUtils();
        String bizOrderNo = System.currentTimeMillis() + "xf";

        //新移动H5快捷支付
        JSONObject quickPayH5 = new JSONObject();
//        quickPayH5.put("bankCardNo", rsa.rsaEncrypt("6228480000666022208"));
        quickPayH5.put("amount", 10);

        JSONArray balances = new JSONArray();
        JSONObject balance = new JSONObject();
        balance.put("amount", 40);
        balance.put("accountSetNo","200001");
        balances.put(balance);

        //组装支付方式
        JSONObject payMethod = new JSONObject();
        payMethod.put("QUICKPAY_PC", quickPayH5);
        payMethod.put("BALANCE",balances);

        JSONArray splitRule = new JSONArray();

        JSONObject splistRule1 = new JSONObject();
        splistRule1.put("bizUserId", "JCBANKPP010");
        splistRule1.put("amount", 50);
        splistRule1.put("fee", 0L);
        splistRule1.put("remark", "aaaaa");

        splitRule.put(splistRule1);

        JSONObject param = new JSONObject();
        param.put("payerId", "yunDemo001");
        param.put("recieverId", "zxccy");
        param.put("bizOrderNo", bizOrderNo);
        param.put("amount", 50);
        param.put("fee", 0);
        param.put("validateType", 1);
//        param.put("splitRule", );
        param.put("frontUrl", "http://122.227.225.142:23661/gateway/getPayFront.jsp");
        param.put("backUrl", "http://10.55.3.236:6003/test/recievePayBack.jsp");
//        param.put("ordErexpireDatetime", );
        param.put("payMethod", payMethod);
        param.put("goodsName", "test_goodsName");
        param.put("goodsDesc", "test_goodsDesc");
        param.put("industryCode", "1010");
        param.put("industryName", "保险行业");
        param.put("source", 2);
        param.put("summary", "testtest_summar");
//        param.put("extendInfo",);


        return param;
    }
}
